<!DOCTYPE html>
<html>
	<head>
		<title>登陆页面</title>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
		<meta name="renderer" content="webkit">
		<!-- 公共样式 开始 -->
		<!-- 公共样式引入 -->
		<link rel="shortcut icon" href="images/favicon.ico" />
		<link rel="bookmark" href="images/favicon.ico" />
		<link rel="stylesheet" type="text/css" href="css/base.css">
		<link rel="stylesheet" type="text/css" href="fonts/iconfont.css">
		<script type="text/javascript" src="framework/jquery-1.11.3.min.js"></script>
		<script type="text/javascript" src="./js/base.js"></script>
		<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
		<script type="text/javascript" src="layui/layui.js"></script>
		<script src="framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
		<!-- 公共样式 结束 -->
		<link rel="stylesheet" type="text/css" href="css/login.css">
		<script type="text/javascript" src="js/login.js"></script>
		<script type="text/javascript">
			/* 表单验证 */
			function check() {
				var v1 = null;
				var user = /^1[3,5,7,8][0-9]{9}$/;
				var us = document.getElementById("account");
				var us1 = us.value;
				if (user.test(us1)) {
					v1 = "<div style='color: green;margin-left: 100px' id='aones'>账户验证成功</div>";
					$("#aone").html(v1);
				}
				if (!user.test(us1)) {
					v1 = "<div style='color: red;margin-left: 100px' id='aones'  >账户格式错误</div>";
					$("#aone").html(v1);
				}
			}
			function checks() {
				var v1 = null;
				var pass = /^[a-zA-Z][a-zA-Z0-9]{5,11}$/;
				var ps = document.getElementById("pass");
				var ps1 = ps.value;
				if (pass.test(ps1)) {
					v1 = "<div style='color: green;margin-left: 100px' id='atwos'>密码验证成功</div>";
					$("#atwo").html(v1);
				}
				if (!pass.test(ps1)) {
					v1 = "<div style='color: red;margin-left: 100px'  id='atwos'>密码格式错误</div>";
					$("#atwo").html(v1);
				}
			}
		</script>
	</head>
	</head>
	<body>
		<!--主体 开始-->
			<div class="login_main">
				<!--轮播图开始-->
				<div class="layui-carousel lbt" id="loginLbt">
					<div carousel-item>
						<div class="item" style="background: url(images/login_bg1.jpg) no-repeat; background-size: cover;"></div>
						<div class="item" style="background: url(images/login_bg2.jpg) no-repeat; background-size: cover;"></div>
					</div>
				</div>
				<!--轮播图结束-->
				<div class="logo">
					<img src="images/login_logo.png" />
					<div>
						<h1>学生综合OA管理系统</h1>
						<p>版本号:19.7.25</p>
					</div>
				</div>
				<div class="form_tzgg">
					<div class="form">
						<div class="layui-form">
							<div class="title" id = "admins">管理员登录</div>
							<div class="con" onclick="getFocus(this)">
								<input type="text" name="userName" lay-verify="required|username"
								placeholder="请输入您的用户名" autocomplete="off" class="layui-input" id="account" oninput="check()"
								onmouseenter="getTips(this, '用户名为11位有效手机号')" onmouseleave="layer.closeAll('tips')">
							</div>
							<span id="aone" style="margin-left: 100px">&nbsp;</span>
							<div class="con" onclick="getFocus(this)">
								<input type="password" name="passWord" required  lay-verify="passWord" 
								placeholder="请输入您的账户密码" autocomplete="off" class="layui-input" id="pass" oninput="checks()"
								onmouseenter="getTips(this, '密码为6-12位字母数字组合的字符')" onmouseleave="layer.closeAll('tips')">
							</div>
							<span id="atwo" style="margin-left: 100px">&nbsp;</span>
							<div class="layui-form-item"  id="one" >
								<input type="radio" name="sex" value="管理员" title="管理员" checked="checked"/>
								<input type="radio" name="sex" value="学生" title="学生"  />
								<input type="radio" name="sex" value="教师" title="教师" />
							</div>
							<div class="but">
								<button class="layui-btn" id="submit">登录</button>
							</div>
							<div class="apply"><a href="#">找回密码</a></div>
						</div>
					</div>
					<div id="lmes" ></div>
					<div class="tzgg">
						<div class="title">通知公告</div>
						<div class="con">
							<ul>
								<li><span>05-01</span><a href="#" target="_blank">嘻嘻嘻嘻</a></li>
								<li><span>04-16</span><a href="#" target="_blank">哈哈哈哈</a></li>
								<li><span>02-23</span><a href="#" target="_blank">嘿嘿嘿嘿</a></li>
							</ul>
						</div>
					</div>
				</div>
			</div>
			<!--主体 结束-->
		</body>
		<script type="text/javascript">
		$("#one").click(function(){
			var v = $('input[name="sex"]:checked').val();
			$("#admins").html(v+"登录");
		});
		$("#submit").click(function(){
			var va = document.getElementById("account").value;
			var vp = document.getElementById("pass").value;
			var v = $('input[name="sex"]:checked').val();
			var s = /response|group_concat|cmd|sysdate|xor|declare|db_name|char| and| or|truncate| asc| desc|drop |table|count|from|select|insert|update|delete|union|into|load_file|outfile/;
			var v2=$("#aones").text();
			var v3=$("#atwos").text();
			if(v2.indexOf("错误")!= -1||v3.indexOf("错误")!= -1){
				layer.msg('登录失败 请检查输入', function(){
				}); 
				return;
			}else if(va.match(s)||vp.match(s)){
				layer.msg('你怎么这么皮 再这样我要报警了 生气', function(){
				}); 
				return;
			}
			if(v=="管理员"){
				$.ajax({
					url:"",
					type:"post",
					data:{
						account:$("#account").val(),
						pass:$("#pass").val(),
					},
					dataType:"json",
					success:function(data){
						if(data.indexOf("成功")!= -1){
							layer.msg("登录成功", {icon: 6},function(){
								window.location.href=""; 
							}); 
						}else{
							layer.msg('登录失败 请检查账户及密码', function(){
							}); 
						}	
					}
				});
			}
			if(v=="教师"){
				$.ajax({
					url:"",
					type:"post",
					data:{
						account:$("#account").val(),
						pass:$("#pass").val(),
					},
					dataType:"json",
					success:function(data){
						if(data.indexOf("成功")!= -1){
							layer.msg("登录成功", {icon: 6},function(){
								window.location.href=""; 
							}); 
						}else{
							layer.msg('登录失败 请检查账户及密码', function(){
							}); 
						}	
					}
				});
			}
		});
		</script>
	</body>
</html>
